<?php
/* @var $this ProductsController */
/* @var $model Products */
/* @var $form CActiveForm */

?>

	<style>
			form {
				margin: 0;
			}
			textarea {width:800px;height:400px;
				display: block;
			}
		</style>
<link rel="stylesheet" href="<?php echo Yii::app()->baseUrl;  ?>/themes/default/default.css" />
<link rel="stylesheet" href="<?php echo Yii::app()->baseUrl;  ?>/plugins/code/prettify.css" />
<script charset="utf-8" src="<?php echo Yii::app()->baseUrl;  ?>/kindeditor/kindeditor-min.js"></script>
<script charset="utf-8" src="<?php echo Yii::app()->baseUrl;  ?>/kindeditor/lang/zh_CN.js"></script>
<script charset="utf-8" src="<?php echo Yii::app()->baseUrl;  ?>/plugins/code/prettify.js"></script>

<script>
			var editor;
			KindEditor.ready(function(K) {
				editor = K.create('textArea[id="Products_description"]', {
					cssPath : '<?php echo Yii::app()->baseUrl;  ?>/kindeditor/plugins/code/prettify.css',
					uploadJson : '<?php echo Yii::app()->baseUrl;  ?>/kindeditor/php/upload_json.php',
					fileManagerJson : '<?php echo Yii::app()->baseUrl;  ?>/kindeditor/php/file_manager_json.php',
					allowFileManager : true,
					fillDescAfterUploadImage:true,
					filterMode:false,
					urlType:"relative"
				});
				K('input[name=getHtml]').click(function(e) {
					alert(editor.html());
				});
				K('input[name=isEmpty]').click(function(e) {
					alert(editor.isEmpty());
				});
				K('input[name=getText]').click(function(e) {
					alert(editor.text());
				});
				K('input[name=selectedHtml]').click(function(e) {
					alert(editor.selectedHtml());
				});
				K('input[name=setHtml]').click(function(e) {
					editor.html('<h3>Hello KindEditor</h3>');
				});
				K('input[name=setText]').click(function(e) {
					editor.text('<h3>Hello KindEditor</h3>');
				});
				K('input[name=insertHtml]').click(function(e) {
					editor.insertHtml('<strong>插入HTML</strong>');
				});
				K('input[name=appendHtml]').click(function(e) {
					editor.appendHtml('<strong>添加HTML</strong>');
				});
				K('input[name=clear]').click(function(e) {
					editor.html('');
				});
			});
		</script>

<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'products-form',
	'enableAjaxValidation'=>false,
   'htmlOptions'=>array('enctype'=>'multipart/form-data'),
)); ?>

	<p class="note">Fields with <span class="required">*</span> are required.</p>

	<?php echo $form->errorSummary($model); ?>

	

	<div class="row">
		<?php echo $form->labelEx($model,'name'); ?>
		<?php echo $form->textField($model,'name',array('size'=>60,'maxlength'=>765)); ?>
		<?php echo $form->error($model,'name'); ?>
	</div>

	<!--  <div class="row">
		<?php echo $form->labelEx($model,'i_order'); ?>
		<?php echo $form->textField($model,'i_order'); ?>
		<?php echo $form->error($model,'i_order'); ?>
	</div>
	-->

	<div class="row">
		<?php echo $form->labelEx($model,'feature_img'); ?>
		<?php echo CHtml::activeFileField($model,'feature_img',array('size'=>60,'maxlength'=>765)); ?>
		<?php echo $form->error($model,'feature_img'); ?>
	</div>
<!--  
	<div class="row">
		<?php echo $form->labelEx($model,'feature_smallimg'); ?>
		<?php echo $form->textField($model,'feature_smallimg',array('size'=>60,'maxlength'=>765)); ?>
		<?php echo $form->error($model,'feature_smallimg'); ?>
	</div>
-->

	<div class="row">
		<?php echo $form->labelEx($model,'introduction'); ?>
		<?php echo $form->textField($model,'introduction'); ?>
		<?php echo $form->error($model,'introduction'); ?>
	</div>

	<div class="row">
		
		<?php echo $form->labelEx($model,'description'); ?>
		<?php echo $form->textArea($model,'description'); ?>
		<?php echo $form->error($model,'description'); ?>
		
	
		
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'price'); ?>
		<?php echo $form->textField($model,'price',array('size'=>18,'maxlength'=>18,'value'=>'0.00')); ?>
		<?php echo $form->error($model,'price'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'discount_price'); ?>
		<?php echo $form->textField($model,'discount_price',array('size'=>18,'maxlength'=>18,'value'=>'0.00')); ?>
		<?php echo $form->error($model,'discount_price'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'delivery_fee'); ?>
		<?php echo $form->textField($model,'delivery_fee',array('size'=>18,'maxlength'=>18,'value'=>'0.00')); ?>
		<?php echo $form->error($model,'delivery_fee'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'online_orderable'); ?>
		<?php echo $form->textField($model,'online_orderable',array('size'=>3,'maxlength'=>3,'value'=>'1')); ?>
		<?php echo $form->error($model,'online_orderable'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'recommended'); ?>
		<?php echo $form->textField($model,'recommended',array('size'=>3,'maxlength'=>3,'value'=>'0')); ?>
		<?php echo $form->error($model,'recommended'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'create_time'); ?>
		<?php echo $form->textField($model,'create_time',array('value'=>date("Y-m-d H:i:s"))); ?>
		<?php echo $form->error($model,'create_time'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'product_category_id'); ?>
		<?php echo $form->textField($model,'product_category_id'); ?>
		<?php echo $form->error($model,'product_category_id'); ?>
	</div>
<!-- 
	<div class="row">
		<?php echo $form->labelEx($model,'s_locale'); ?>
		<?php echo $form->textField($model,'s_locale',array('size'=>60,'maxlength'=>150)); ?>
		<?php echo $form->error($model,'s_locale'); ?>
	</div>
-->

	<div class="row">
		<?php echo $form->labelEx($model,'pub_start_time'); ?>
		<?php echo $form->textField($model,'pub_start_time',array('value'=>date("Y-m-d H:i:s"))); ?>
		<?php echo $form->error($model,'pub_start_time'); ?>
	</div>

	<div class="row">
		<?php //echo $form->labelEx($model,'pub_end_time'); ?>
		<?php echo $form->hiddenField($model,'pub_end_time',array('value'=>-1)); ?>

		<?php echo $form->error($model,'pub_end_time'); ?>
		
		
		
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'published'); ?>
		<?php echo $form->textField($model,'published',array('size'=>3,'maxlength'=>3,'value'=>1)); ?>
		<?php echo $form->error($model,'published'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'v_num'); ?>
		<?php echo $form->textField($model,'v_num',array('size'=>20,'maxlength'=>20,'value'=>'0')); ?>
		<?php echo $form->error($model,'v_num'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'for_roles'); ?>
		<?php echo $form->textField($model,'for_roles',array('size'=>60,'maxlength'=>150,'value'=>"{member}{admin}{guest}")); ?>
		<?php echo $form->error($model,'for_roles'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'is_seo'); ?>
		<?php echo $form->textField($model,'is_seo',array('size'=>3,'maxlength'=>3,'value'=>1)); ?>
		<?php echo $form->error($model,'is_seo'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'meta_key'); ?>
		<?php echo $form->textField($model,'meta_key'); ?>
		<?php echo $form->error($model,'meta_key'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'meta_desc'); ?>
		<?php echo $form->textField($model,'meta_desc'); ?>
		<?php echo $form->error($model,'meta_desc'); ?>
	</div>

	<div class="row buttons">
		<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->